def aaa(b):
    while '()' in b or '[]' in b or '{}' in b:
        b = b.replace('()','')
        b = b.replace('[]','')
        b = b.replace('{}','')

    return not b

ye = input()
print(aaa(ye))
